package cn.imokay.springboot.yml.controller;

import cn.imokay.springboot.yml.configmodel.ConfigModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 孟震
 */
@RestController
//注入的配置类通过ConstructorBinding时,需要开启以下注解,同时配置类不需要Compment等注解
@EnableConfigurationProperties(ConfigModel.class)
public class HelloSpringbootYmlController {
    @Autowired
    private ConfigModel model;

    @RequestMapping("hello1")
    public String hello1(){
        System.out.println(model.toString());
        System.out.println("------------");

        return model.toString();
    }
}
